package com.niodata.md.rdb.crawler;

import com.niodata.md.rdb.model.Catalog;
import java.sql.DatabaseMetaData;

/**
 * abstract class for retrieval.
 */
public abstract class AbstractRetrieval implements MetaDataRetrieval {

  private String[] parentPath;
  private Catalog catalog;
  private DatabaseMetaData metaData;
  private DataSourceInfo dataSourceInfo;

  public void setCatalog(Catalog catalog) {
    this.catalog = catalog;
  }

  public void setMetaData(DatabaseMetaData metaData) {
    this.metaData = metaData;
  }

  public void setDataSourceInfo(DataSourceInfo dataSourceInfo) {
    this.dataSourceInfo = dataSourceInfo;
  }

  @Override
  public void setParentPath(String[] parentPath) {
    this.parentPath = parentPath;
  }

  public String[] getParentPath() {
    return parentPath;
  }

  public Catalog getCatalog() {
    return catalog;
  }

  public DatabaseMetaData getMetaData() {
    return metaData;
  }

  public DataSourceInfo getDataSourceInfo() {
    return dataSourceInfo;
  }

  /**
   * copy retrieval context from another retrieval.
   *
   * @param retrieval retrieval to copy context from
   */
  public void copyContext(AbstractRetrieval retrieval) {
    this.setCatalog(retrieval.getCatalog());
    this.setDataSourceInfo(retrieval.getDataSourceInfo());
    this.setMetaData(retrieval.getMetaData());
  }

}
